package main

import (
	"github.com/EDDYCJY/go-gin-app/models"
	"github.com/robfig/cron"
	"log"
	"time"
)

func main()  {
	log.Println("Starting......")
	c := cron.New()
	c.AddFunc("* * * * * *", func() {
		log.Println("清除无用标签.....")
		models.CleanAllTag()
	})
	c.AddFunc("* * * * * *", func() {
		log.Println("清除无用文章.....")
		models.CleanAllArticle()
	})
	c.Start()
	t1 := time.NewTimer(time.Second*10)
	for {
		select {
			case <- t1.C:
				t1.Reset(time.Second*10)
		}
	}
}
